<template>
  <div>
    <!-- 顶部的卡片 -->
    <ul>
      <li>
        <i class="iconfont icon-shuju"></i>
        <div>
          <p>今日销量</p>
          <span>988</span>
        </div>
      </li>
      <li>
        <i class="iconfont icon-jinexianxing"></i>
        <div>
          <p>今日销售额</p>
          <span>24,700.64</span>
        </div>
      </li>
      <li>
        <i class="iconfont icon-renwu"></i>
        <div>
          <p>总销量</p>
          <span>11579</span>
        </div>
      </li>
      <li>
        <i class="iconfont icon-tongji"></i>
        <div>
          <p>总销售额</p>
          <span>289,475.58</span>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { homeData } from '../../api/home.js'
export default {
  data() {
    return {
      topData: {}
    }
  },
  created() {
    this.getDatas()
  },
  methods: {
    async getDatas() {
      const users = JSON.parse(localStorage.getItem('users') || '{}')
      const data = await homeData({
        member_id: users.member_id,
        access_token: users.access_token
      })
      console.log(data)
    }
  }
}
</script>

<style lang="less" scoped>
ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;

  li {
    flex: 0 0 22%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ccc;
    padding: 15px;
    box-sizing: border-box;
    border-radius: 6px;
    color: #fff;

    i {
      font-size: 35px;
      color: #f44336;
    }

    p {
      margin: 0;
      font-size: 14px;
      color: #eee;
      text-align: right;
      margin-bottom: 8px;
    }

    span {
      font-weight: 700;
      font-size: 18px;
    }

    &:nth-of-type(1) {
      background: linear-gradient(90deg, #ff9800, #ff5722);
    }
    &:nth-of-type(2) {
      background: linear-gradient(90deg, #03a9f4, #2196f3);
      i {
        color: #3f51b5;
      }
    }
    &:nth-of-type(3) {
      background: linear-gradient(90deg, #ff9800, #ff5722);
      i {
        color: #e4e4e4;
      }
    }
    &:nth-of-type(4) {
      background: linear-gradient(90deg, #ff9800, #ff5722);
      i {
        color: #f8f8f8;
      }
    }
  }
}
</style>
